<%--
  Created by IntelliJ IDEA.
  User: 骆鹏
  Date: 2017/7/28
  Time: 13:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<html>
<head>
    <title>事件查询</title>
    <meta name="viewport" content="width=device-width, initial-scale=0.3, user-scalable=0, minimum-scale=0, maximum-scale=5.0,user-scalable=yes">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base.css">

    <link rel="stylesheet" href="/lib/laydate.css">
    <script src="/lib/laydate.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/lib/jquery-validate.js"></script>
    <script src="/lib/validate-mothods.js"></script>
    <style>
        /*.fffbg tbody tr{*/
        /*background: #fff!important;*/
        /*}*/
        /*.eeebg{*/
        /*background: #eee!important;*/
        /*}*/
        .fffbg tbody tr input[type=text]{
            width: 70%;
            height:30px;
            border:1px solid #ccc;
            border-radius: 4px;
            padding-left: 10px;
        }
        .fffbg tbody tr select{
            width: 70%;
            height:30px;
            border:1px solid #ccc;
            border-radius: 4px;
            padding-left: 10px;
        }

        #btnsearch{
            float:right;
            margin-top: 0.6%;
            margin-right: 4.5%;
            padding: 5px 10px;
            background: #2b7fe0;
            color: #fff;
            border-radius: 6px;

        }
        .errrs{
            width:100px;
            height: 100px;
            background: #2b7fe0;
            display: inline-block;
        }
        input[type=submit]{
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left:5px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 14px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            border:none;
        }
        .chongzhi{
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left:2px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 13px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            display: inline-block;
            border:none;
        }
        textarea{
            outline: none;
            width: 70%;
            border-radius: 4px;
            padding:10px;
            height:60px;
        }
        input[type=button] {
            width: 70px;
            height: 28px;
            line-height: 26px;
            padding-left: 5px;
            text-align: center;
            background-image: url(../img/center_q.png);
            background-repeat: no-repeat;
            color: #000;
            cursor: pointer;
            font-size: 14px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            float: none;
            border: none;
        }
        .active{
            display: block;
        }
        .hide{
            display: none;
        }
        .fl input{
            width: 29px;
        }
    </style>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<div class="headTop">
    <div class="headImg">
        <img src="/img/document/icon_documentQuery.png" alt="">
    </div>
    <div class="divTitle">
        事件查询
    </div>
    <span id="sudoo" class="hide"><a href="javascript:void(0)" id="btnsearch"><fmt:message code="doc.th.AdvancedSearch"/></a></span>
</div>

<div style="margin: 0 auto;margin-top: 10px;height: 60px;width: 97%;" class="clearfix">

</div>
<div style="margin: 0 auto;width: 97%;">

    <div class="formData" style="display: none">
        <form id="registerForm" action="/gridEvent/selectGridEvent">
            <input type="hidden" name="page">
            <input type="hidden" name="pageSize">
            <input type="hidden" name="exportId" value="1">
            <%--/document/selectDocSelective--%>
            <table class="fffbg">
                <thead>
                <tr>
                    <th width="15%" style="font-size: 16pt;"><fmt:message code="doc.th.CommonConditions" /></th>
                    <th width="35%"></th>
                    <th width="15%"></th>
                    <th width="35%"></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="15%">
                        上报人：
                    </td>
                    <td width="35%" style="text-align: left">

                        <textarea name="" readonly style="vertical-align: middle" placeholder="上报人" id="creater" cols="30" rows="10"></textarea>
                        <a href="javascript:void (0)" style="vertical-align: bottom" data-num="1" class="theCandidates"><fmt:message code="global.lang.select"/></a>
                        <a href="javascript:void (0)" class="clearAll" style="vertical-align: bottom"><fmt:message code="global.lang.empty"/></a>
                        <input type="hidden" name="userId">
                    </td>
                    <td width="15%">
                        网络社区名称：
                    </td>
                    <td width="35%">
                        <select style="float: left" name="gridId" >
                            <option value=""><fmt:message code="hr.th.PleaseSelect"/></option>
                        </select>

                    </td>
                </tr>
                <tr>
                    <td width="15%">
                        办理状态：
                    </td>
                    <td width="35%" style="text-align: left">
                        <select name="flowStatus" >
                            <option value=""><fmt:message code="hr.th.PleaseSelect"/></option>
                            <option value="0">未转交</option>
                            <option value="1">已转交</option>
                        </select>
                    </td>
                    <td width="15%">
                        上报时间：
                    </td>
                    <td width="35%" style="text-align: left">
                        <input type="text" style="width: 30%;margin-right: 10px;" placeholder="请输入开始" name="beginDate" onclick="laydate({format:'YYYY-MM-DD hh:mm:ss'})" > <span style="float:left;">至</span>
                        <input type="text" style="width: 30%;margin-left: 10px" placeholder="请输入结束" name="endDate" onclick="laydate({format:'YYYY-MM-DD hh:mm:ss'})">
                    </td>
                </tr>

                <tr>
                    <td colspan="4">
                        <%--<a href="javascript:void(0)" style="margin-right: 10px" class="dataBtn">搜索</a>--%>
                        <input id="sodu" type="button" value="<fmt:message code="workflow.th.sousuo"/>">
                        <a href="javascript:void(0)" class="chongzhi"><fmt:message code="workflow.th.Reset"/></a>
                    </td>

                </tr>
                </tbody>
            </table>
        </form>
    </div>


    <div class="tableData" style="display: none;position: relative">


        <table class="fffbg">
            <thead>
            <tr>
                <th>序号</th>
                <th>社区名称</th>
                <th>上报人</th>
                <th>上报时间</th>
                <%--<th>办理状态</th>--%>
                <th>事件类型</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
    </div>
</div>

<div id="dbgz_page" class="M-box3 fl" style="margin-bottom: 10px;display: none"></div>
<script>
    var ajaxPage={
        data:{
            page:1,//当前处于第几页
            pageSize:10//一页显示几条


        },
        page:function (num) {
            var me=this;
            $('[name="page"]').val(this.data.page)
            $('[name="pageSize"]').val(this.data.pageSize)
            if($('[name="userId"]').siblings('textarea').attr('user_id')!=undefined){
                $('[name="userId"]').val($('[name="userId"]').siblings('textarea').attr('user_id').replace(/,/,''))
            }
            if($('[name=" deptId"]').siblings('textarea').attr('deptid')!=undefined){
                $('[name=" deptId"]').val($('[name=" deptId"]').siblings('textarea').attr('deptid').replace(/,/,''))
            }




            $('#registerForm').ajaxSubmit({
                type:'post',
                dataType:'json',
                success:function (json) {
                    if(json.flag){
                        if(json.datas.length>0) {
                            $('.formData').hide()
                            $('.tableData').show()
                            var  dataArr=json.datas;
                            var str = '';
                            for (var i = 0; i < dataArr.length; i++) {
                                str+='<tr ><td>'+(i+1)+'</td>' +
                                    '<td>'+dataArr[i].gridName+'</td>' +
                                    '<td>'+dataArr[i].userName+'</td>' +
                                    '<td>'+dataArr[i].dateTime+'</td>' +
                                    //                                    '<td>'+function () {
                                    //                                        if(dataArr[i].flowStatus==0){
                                    //                                            return '未转交'
                                    //                                        }else if(dataArr[i].flowStatus==1){
                                    //                                            return '已转交'
                                    //                                        }
                                    //                                    }()+'</td>' +
                                    '<td>'+dataArr[i].codeName+'</td>' +
                                                                        '<td><a href="/workflow/work/workformPreView?flowId='+function(){if(dataArr[i].flowId==undefined){return ''}else{return dataArr[i].flowId}}()+'&prcsId='+dataArr[i].prcsId+'&flowStep='+dataArr[i].prcsId+'&runId='+dataArr[i].rumId+'&tabId='+dataArr[i].eventId+'&tableName=grid_event&isNomalType=true&hidden=true" target="_blank" class="detail">查看详情</a></td>' +
                                    '</tr>'

                            }
                            $('.tableData table tbody').html(str)
//                            me.pageTwo(json.total, me.data.pageSize, me.data.page)
                            if(json.total>10){
                                $('#dbgz_page').show();
                                me.pageTwo(json.total, me.data.pageSize, me.data.page)
                            }else{
                                $('#dbgz_page').hide();
                            }
                        }else {
                            $.layerMsg({content:'<fmt:message code="doc.th.NoData"/>！',icon:2});
                        }

                    }
                }
            })
        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {

                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    var user_id='';
    var dept_id='';
    var getobj=$.GetRequest();
    //    var priv_id='';
    $.get('/gridInfo/gridSettingsTrees?typeId=0',function (json) {
        if(json.flag){
            var str='<option value="">请选择</option>';
            for(var i=0;i<json.obj.length;i++){
                str+='<option value="'+json.obj[i].gridId+'">'+json.obj[i].gridName+'</option>'
            }
            $('[name="gridId"]').html(str)


        }
    },'json')


    $('input[type=button]').click(function () {
        ajaxPage.page()
    })
    if(getobj.type=='all'){
        ajaxPage.data.pageSize=10;
        $('input[type=button]').trigger('click')
        $('.divTitle').text('上报事件')
        document.title='上报事件'
    }















    $('.theCandidates').click(function () {

        var num=$(this).attr('data-num')
        if(num==1) {
            user_id = $(this).siblings('textarea').prop('id');
            $.popWindow("../common/selectShiyuanUser?0");
        }else if(num==2){
            dept_id=$(this).siblings('textarea').prop('id');
            $.popWindow("../common/selectDept?0");
        }
    })




    $('#btnsearch').click(function () {
        $('.formData').show()
        $('.tableData').hide()
        $('#dbgz_page').hide()
        $('#btnsearch').hide()

    })

    $('#sodu').click(function () {
        $('#btnsearch').show()
        $('#sudoo').removeClass('hide');
        $('#sudoo').addClass('active');
        $('#dbgz_page').show()
    })


























    $(function () {




    })

    $('.chongzhi').click(function () {
        $('#registerForm input[type=text]').each(function (i,n) {
            $(this).val('')
        })
        $('#registerForm select option').each(function (i,n) {
            if($(this).val()==''){
                $(this).attr('selected',true)
            }else {
                $(this).removeAttr('selected')
            }
        })
        $('#registerForm textarea').val('')
        $('#registerForm textarea').attr('user_id','')
        $('#registerForm textarea').attr('deptid','')
    })


    $('.clearAll').click(function () {
        $(this).siblings('textarea').attr('user_id','')
        $(this).siblings('textarea').attr('deptid','')
        $(this).siblings('textarea').val('')
    })

</script>
</body>
</html>
